﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace WindowsFormsApp2
{
    class DbHelper
    {
        private static readonly string connStr = "server=.;database=Admin001;uid=sa;pwd=123456";
        public static DataTable GetDataTable(string sql)
        {
            

            SqlConnection sqlCon = new SqlConnection(connStr);
            sqlCon.Open();
            DataTable table = new DataTable();
            SqlDataAdapter sqlData = new SqlDataAdapter(sql, sqlCon);
            sqlData.Fill(table);
            return table;
        }
    }
}
